package com.proyecto.xpdroid.util;


import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import com.droid.users.util.GastoHolder;

public class XmlHolder
{

    public void getXML(String xmlstring)
        throws XmlPullParserException, IOException
    {
        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(true);
        XmlPullParser xpp = factory.newPullParser();
        
        ArrayList<GastoHolder> objetos = null;
        GastoHolder currentObjeto = null;

        //xpp.setInput(new StringReader ("<foo>Hello World!</foo>"));
        xpp.setInput(new StringReader (xmlstring));
        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String name = null;
         if(eventType == XmlPullParser.START_DOCUMENT) {
        	 objetos = new ArrayList();
             System.out.println("Start document");
         } else if(eventType == XmlPullParser.END_DOCUMENT) {
             System.out.println("End document");
         } else if(eventType == XmlPullParser.START_TAG) {
             System.out.println("Start tag "+xpp.getName());
         } else if(eventType == XmlPullParser.END_TAG) {
             System.out.println("End tag "+xpp.getName());
         } else if(eventType == XmlPullParser.TEXT) {
             System.out.println("Text "+xpp.getText());
         }
         eventType = xpp.next();
        }
    }
} 
